PrizmDoc v13.0 - Updated
HTML5 Viewing
API Reference > PrizmDoc Server RESTful API > HTML5 Viewing

HTML5 viewing information.

Available URLs

GET Page/q/{PageNumber}/Attributes?DocumentID=[e,u]{ViewingSessionId}

This API requests or reads the information about a particular document page. The return information is a JSON string. The form has a query parameter, DocumentID, which can have for its value an un-encoded "u" prefix followed by the viewing session ID or a base 64 encoded viewing session ID prefixed with "e". The {PageNumber} parameter always begins with zero (0) for the first page within a document.

Http Method

GET

Resource URL

/PCCIS/V1/Page/q/{pageNumber}/Attributes?DocumentID=[e,u]{ViewingSessionId}& ContentType=[png, svg, svga, svgb]

Parameters

PageNumber

The page number of the document being requested. The first page within a document is always 0.

DocumentID

The Viewing Session ID.

ContentType

(Optional). The intended content of the page image. 

Request Body

Empty.

Response Body

If successful, this method returns an object with the following properties:

Property Name

Value

Description

version

String

The version of the Viewer to consume this request.

contentType

String

The type of content that is available for this document.

imageBitDepth

Integer

The bit depth of the viewable content.

imageHeight

Integer

The height of the viewable content.

imageWidth Integer The width of the viewable content.

imageXResolution

Integer

The X resolution of the viewable content.

imageYResolution

Integer

The Y resolution of the viewable content.

Example
Copy Code
GET http://localhost:18681/PCCIS/V1/Page/q/0/Attributes?DocumentID=eOQA...
Example Response
Copy Code
{"version":"7.1","contentType":"jpeg,png,svg","imageBitDepth":16, "imageHeight":990,"imageWidth":765,"imageXResolution":0,"imageYResolution":0}

 

GET Page/q/{PageNumber}?DocumentID=[e,u]{ViewingSessionId}&Scale={Scale}&ContentType=[jpeg, png, svg, svga, svgb]

This RESTful API returns a full page image. The Scale and ContentType query parameters affect the image with respect to the parameters intent. The ContentType parameter may have the following parameter value for now: JPEG, PNG, SVG, SVGA, or SVGB. If SVG, SVGA, or SVGB is chosen, the scale values are ignored as a SVG (vectored) stream is returned for which this parameter has no practical meaning. The scale query parameter with a value 1.0 gives a non-resized image. Less than 1.0 values shrink the image and larger than 1.0 values increase the image size.

SVGA is standard SVG content with additional optimizations to reduce the payload size. SVGA is not compatible with the Internet Explorer 10 browser, in which case SVG should be used instead.
SVGB is standard SVG content additionally optimized by replacing SVG curves representing font letters with Unicode font to reduce payload size. Note: "svgb" provides better optimization and visually more consistent results. SVGB is not compatible with the Internet Explorer 9 & 10 browser, desktop Safari 9.x or Chrome on Windows in which case SVG, or SVGA for IE 9, should be used instead.

The API will now interpret an optional request header:

Accept-Encoding: gzip[,deflate,sdch]

The API will look for the value 'gzip' to mean that the Viewer is able to handle Gzipped SVG/SVGA/SVGB content. Based on this header value, the API will compress the response SVG/SVGA/SVGB content using the Gzip format. It will add the following header in the response:

Content-Encoding: gzip

Uncompressed data lengths less than 500 bytes will not be compressed.

Most modern browsers can handle Gzipped content. If you would like to see reduction in the network bandwidth usage for the SVG/SVGA/SVGB content in the response, then make sure that your webtier/proxy does not strip these headers.

Raster Images (content types : png,jpg) will not be Gzip compressed.

Http Method

GET

Resource URL

/PCCIS/V1/Page/q/{PageNumber}?DocumentID=[e,u]{ViewingSessionId}&Scale={Scale}&ContentType=[jpeg, png, svg, svga, svgb]

Parameters

PageNumber

The page number of the document being requested. The first page within a document is always 0.

DocumentID

The Viewing Session ID.

Scale

The intended scale value of the page image. This is ignored for SVG streams.

ContentType

The intended content type of the page image.

Request Header

(optional)

Accept-Encoding: gzip[,deflate,sdch]

Request Body

Empty.

Response Header

Content-Encoding: gzip

Note: This header will exist only if the request contained the optional header, Accept-Encoding: gzip.

Response Body

If successful, this method returns either the requested page content or, if the requested svg content type cannot be provided, an object is returned containing an errorCode with the value SvgNotAvailable and the pageAttributes for png content type. This is provided as an optimization to fallback to png when svg is not available.

Example
Copy Code
GET http://localhost:18681/PCCIS/V1/Page/q/0?DocumentID=eOQA5... &Scale=1&ContentType=svg

 

Example Response
Copy Code
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns=http://www.w3.org/2000/svg xmlns:cc="http://creativecommons.org/ns#" ...</svg>

 

 

GET Page/q/{PageNumber}/Tile/{x}/{y}/{width}/{height}?DocumentID=[e,u]{ViewingSessionId}&Scale={Scale Value}&ContentType=png

This request returns a tile of the requested document page. The tile is formed from the pixel coordinate specified by the x and y parameters and the width and height parameters. This tile is resized as determined by the scale factor. The contentTypeshould only be PNG for tiles as JPEG can cause artifact issues in alignment. Requesting SVG content will cause an error response as this content type is vector data and does need to be tiles like raster images. The scale query parameter with a value 1.0 gives a non-resized image. Less than 1.0 values shrink the tile and larger than 1.0 values increase the tile size.

Http Method

GET

Resource URL

/Page/q/{pageNumber}/Tile/{x}/{y}/{width}/{height}?DocumentID=[e,u]{ViewingSessionId}&Scale={Scale Value}&ContentType=png

Parameters

PageNumber

The page number of the document being requested. The first page within a document is always 0.

DocumentID

The Viewing Session ID.

Scale

The intended scale value of the page image. This is ignored for SVG streams.

ContentType

The intended content type of the page image.

x

The x coordinate of the requested tile relative to the original image.

y

The y coordinate of the requested tile relative to the original image.

width

The width of the requested tile.

height

The height of the requested tile.

Request Body

Empty.

Response Body

If successful, this method provides the requested page tile content.

Example
Copy Code
GET http://localhost:18681/PCCIS/V1/Page/q/0/ Tile/0/0/1275/1024?DocumentID=eOAA5... &Scale=1&Quality=100&ContentType=png

 

Example Response
Copy Code
Empty

 

 

GET Page/q/{PageNumber}/{Width}x{Height}?DocumentID=[e,u]{ViewingSessionId}&ContentType=[jpeg,png]

This request returns a thumbnail of the requested document page. The thumbnail size is constrained within the width and height pixel parameters and the aspect ratio of the image is maintained. The contentType can only be PNG or JPEG.

Http Method

GET

Resource URL

/Page/q/{pageNumber}/{width}x{height}?DocumentID=[e,u]{ViewingSessionId}&ContentType=[jpeg, png]

Parameters

PageNumber

The page number of the document being requested. The first page within a document is always 0.

DocumentID

The Viewing Session ID.

ContentType

The intended content type of the thumbnail page image.

width

The maximum width of the requested thumbnail.

height

The maximum height of the height of the requested thumbnail.

Request Body

Empty.

Response Body

If successful, this method provides the requested page thumbnail content.

Example
Copy Code
GET http://localhost:18681/PCCIS/V1/Page/q/0/ 200x300?DocumentID=eOAA5... &ContentType=png

 

Example Response
Copy Code
Empty

 

 

GET Document/q/Attributes?DocumentID=[e,u]{ViewingSessionId}&DesiredPageCountConfidence={PercentageValue}

This request returns a JSON string giving the page count of the document requested and the confidence value. Because page rendering may be different than what a file format may indicate for number of pages, there is a need for a confidence value indicating how confident the page count acquired will be prior to having all the pages generated.

The DesiredPageCountConfidence parameter indicates what the minimum level required to be returned thus implying how long the request may take to return a precise value.

The DesiredPageCountConfidence is segmented in this release where 50 percent or below may get an estimate page count value and above 50 percent will try to get a more accurate count. If a pageCountConfidence value of less than 100 percent is returned, it means that the request is still being worked on and to try again if an accurate count is still desired.

Http Method

GET

Resource URL

Parameters

DocumentID

The Viewing Session ID.

DesiredPageCountConfidence

The intended percentage of confidence to use in determining the page count.

Request Body

Empty.

Response Body

If successful, this method returns an object with the following properties:

Property Name

Value

Description

pageCount

Integer

The determined number of pages in the document.

pageCountConfidence

Integer

If value is less than 100 it means that the page count is still being determined, and to try again if a more accurate count is needed.

Example
Copy Code
GET http://localhost:18681/PCCIS/V1/ Document/q/Attributes?DocumentID=eOQA5... &DesiredPageCountConfidence=50
Example Response
Copy Code
{"pageCount":3,"pageCountConfidence":100}

 

GET Document/q/{PageNumberBegin}-{PageNumberEnd}/Text?DocumentID=[e,u]{ViewingSessionId}

This request returns a JSON string containing the text extracted from the given document. The {PageNumberBegin} denotes the first page and {PageNumberEnd} denotes the last page to be included for text extraction. Additionally, information on hyperlinks will be returned if any is available. The lowest value for {PageNumberBegin} parameter is zero (0) – that indicates the first page within the document.

The API will now interpret an optional request header:

Accept-Encoding: gzip[,deflate,sdch]

The API will look for the value 'gzip' to mean that the Viewer is able to handle Gzipped extracted text content. Based on this header information, the API will compress the extracted text data content using Gzip format. It will add the following header in the response:

Content-Encoding: gzip

Uncompressed data lengths less than 500 bytes will not be compressed.

Most modern browsers can handle Gzipped content. If you would like to see reduction in the network bandwidth usage for the extracted text content in the response, then make sure that your webtier/proxy does not strip these headers.

Http Method

GET

Resource URL

/PCCIS/V1/ Document/q/0-2/Text?DocumentID=eMAA2...

Parameters

DocumentID

The Viewing Session ID.

PageNumberBegin

The page to begin extracting text from.

PageNumberEnd

The page to end extracting text from.

Request Header

(optional)

Accept-Encoding: gzip[,deflate,sdch]

Request Body

Empty.

Response Header

Content-Encoding: gzip

Note: This header will exist only if the request header contained the optional header, Accept-Encoding: gzip.

Response Body

If successful, this method returns an object with the following properties:

Property Name

Value

Description

pages

List

A list of Nested Objects describing the extracted text for each of the pages in range.

pages.number

Integer

Denotes the number the current page to which the extracted text belongs.

pages.text

String

Extracted text of the current page.

pages.markup List A list of nested objects describing the hyperlinks if there are any.
pages.markup.changeType String The changeType will always be "Add".
pages.markup.markType String The markType will always be "DocumentHyperlink".
pages.markup.properties Object Object containing properties of the hyperlink.
pages.markup.properties.href String A value that indicates the destination of the Hyperlink.
pages.markup.properties.rectangle Object These values will be defined in points (1/72 inch).
pages.markup.properties.rectangle.x Integer The x location of the hyperlink markup to be applied.
pages.markup.properties.rectangle.y Integer The y location of the hyperlink markup to be applied.
pages.markup.properties.rectangle.width Integer The width of the hyperlink markup to be applied.
pages.markup.properties.rectangle.height Integer The height of the hyperlink markup to be applied.
pages.markup.properties.borderHorizontalRadius Integer The horizontal radius of the border of the markup to be applied.
pages.markup.properties.borderVerticalRadius Integer The vertical radius of the border of the markup to be applied.
pages.markup.properties.borderThickness Integer The width of the border of the markup to be applied.

Example
Copy Code
GET http://localhost:18681/PCCIS/V1/Document/q/0-2/Text?DocumentID=eMAA2...

Example Response - With Hyperlink Data
Copy Code
"pages":[{"number" : 0, "text":"Congratulations You have successfully installed Prizm Content Connect www.accusoft.com Page 1 of Document",
"width":612, "height":792, "rectangles":[[97.8, 66.47, 43.32, 74.49], ..., [416.77, 520.44, 6.5, 32.28]], "markup":[{"changeType":"Add",
"markType":"DocumentHyperlink", "properties":{"href":"http:www.accusoft.com", "rectangle":
{"x":228.1, "y":329.0, "width":155.9, "height":23.0}
, "borderHorizontalRadius":0.0, "borderVerticalRadius":0.0, "borderThickness":0.0}}]}]}

Example Response - Without Hyperlink Data
Copy Code
{"pages":[{"number":0,"text":"Congratulations You have successfully installed Prizm Content Connect  www accusoft com  Page 1 of Document"},
{"number":1, "text":"Page 2 of Document"},
{"number":2,"text":"Page 3 of Document"}]}

 

 

GET /v2/viewingSessions/{viewingSessionId}/revisionData?limit={limit}&continueToken={continueToken}

Gets objects which describe known changes between two documents, with a limit on how many should be returned at once.

This URL is designed to give you an array of changes in chunks as the individual changes become available. Each GET request will return the currently-known changes up to a limit (default is 100). If a response contains a continueToken, it indicates that additional changes may be available and that you should issue another GET request using that continueToken as a query string parameter to skip the changes you have already received. As long as a response contains a continueToken, use it to issue a subsequent GET for more changes. When you encounter a response which does not have a continueToken, you have received all of the changes and no more GET requests are necessary.

In order to optimize the number of network requests you make, any response which contains a continueToken will also contain a continueAfter value with a recommended number of milliseconds you should wait before sending the next GET request.

Request

URL Parameters

Parameter Description
{limit} The maximum number of changes to return for this HTTP request. Must be an integer greater than 0. Default is 100.
{continueToken} Used to continue getting changes from the point where a previous GET request left off.

Request Headers

Name Description
Accept-Encoding Set to gzip to get a gzipped response body.

Successful Response

Response Headers

Name Description
Content-Encoding

Will be set to gzip if the request used Accept-Encoding: gzip.

Response Body

JSON with available changes.

Error Responses

Status Code JSON errorCode Description
404 - No viewing session with the provided viewingSessionId could be found.
480 "InvalidInput" An invalid input value was used. See errorDetails in the response body.
580 "InternalError" The server encountered an internal error when handling the request.

Example

Here is an example sequence of requests and responses illustrating how you would acquire the full set of changes for a comparison viewing session (for brevity, the total number of changes in this example is small).

You would start with an initial GET:

Example
Copy Code
GET /v2/viewingSessions/luMJZGIeGQr20veYl5JQwsv77iIvaFsvHAW4x1L88lkBs8mk63aArufxZ9jaXZ0ykG5LsMlWorI6u3Ui6YApkw/revisionData     
Accept-Encoding: gzip
Example
Copy Code
HTTP/1.1 200 OK
 Content-Type: application/json
 Content-Encoding: gzip
{
   "changes": [],
   "continueToken": "luMJZGIeGQr20veYl5JQwsv77iIvaFsvHAW4x1L88lmZwRo30ojTLjaT0J2D2f8D",
   "continueAfter": 500
 }

In this case, the initial response did not return any changes at all (the changes array is empty), but the presence of a continueToken indicates they may simply not have been available yet. We should issue another GET request after waiting 500 milliseconds (the amount of time recommended by continueAfter).

So, half a second later, we issue a follow-up request with the continueToken passed in as a query string parameter:

Example
Copy Code
GET /v2/viewingSessions/luMJZGIeGQr20veYl5JQwsv77iIvaFsvHAW4x1L88lkBs8mk63aArufxZ9jaXZ0ykG5LsMlWorI6u3Ui6YApkw/revisionData?continueToken=luMJZGIeGQr20veYl5JQwsv77iIvaFsvHAW4x1L88lmZwRo30ojTLjaT0J2D2f8D         
Accept-Encoding: gzip

HTTP/1.1 200 OK
Content-Type: application/json
Content-Encoding: gzip
{
  "changes": [
    {
      "id": 0,
      "endPageIndex": 0,         
      "type": "contentInserted"
    },
    {
      "id": 1,
      "endPageIndex": 0,               
      "type": "contentDeleted"
    }
  ],
  "continueToken": "luMJZGIeGQr20veYl5JQwsv77iIvaFsvHAW4x1L88lklhqP2L79Yero0nM9aoZ9r",
  "continueAfter": 500
}

This time we receive two changes. The presence of a new continueToken tells us there may be more, so we submit another request with the new continueToken.

Notice in the next response that the changes which have already been given to us are not repeated:

Example
Copy Code
GET /v2/viewingSessions/luMJZGIeGQr20veYl5JQwsv77iIvaFsvHAW4x1L88lkBs8mk63aArufxZ9jaXZ0ykG5LsMlWorI6u3Ui6YApkw/revisionData?continueToken=luMJZGIeGQr20veYl5JQwsv77iIvaFsvHAW4x1L88lklhqP2L79Yero0nM9aoZ9r         
Accept-Encoding: gzip

HTTP/1.1 200 OK
Content-Type: application/json
Content-Encoding: gzip
{
  "changes": [
    {
      "id": 2,
      "endPageIndex": 5,              
      "type": "styleChanged"
    }
  ]
}

This time we get a new change, and the lack of a continueToken tells us we have received all of the changes, so there are no more GET requests to make.